﻿<Window x:Class="Orbifold.Trefoil.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:Orbifold.Trefoil"
  
    Title="Trefoil" Height="500" Width="800" 
    Icon="/images/fonfile.ico" 
    Style="{StaticResource OfficeStyle}" 
  
   > 
  <DockPanel LastChildFill="True">
    <local:PopupColorPicker x:Name="colorPicker"  ShowParentButton="false"/>
    <Border DockPanel.Dock="Bottom" 
                CornerRadius="0,0,5,5" 
                BorderThickness="0,1,0,0" 
                BorderBrush="{StaticResource BorderBrush}" 
                Background="{StaticResource StatusBackgoundBrush}">
      <StatusBar Height="20" Background="Transparent" >
        <StatusBarItem>
          <TextBlock Margin="7,0,0,0" Foreground="{StaticResource TabTextBrush}">Ready</TextBlock>
        </StatusBarItem>
      </StatusBar>
    </Border >
    <TabControl Margin="4" DockPanel.Dock="Top" Height="150"                
                 FocusManager.IsFocusScope="True">    
      <TabItem Header="Home">
        <ItemsControl 
            Name="ribbonList1"
            ItemsSource="{Binding Source={StaticResource ShapesSource}}"
            FocusManager.IsFocusScope="True" >
          <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
              <!--This controls the layout of the actual buttons and other elements inside a group-->
              <WrapPanel IsItemsHost="True" Margin="3" ItemHeight="30"  Orientation="Horizontal" HorizontalAlignment="Stretch"   VerticalAlignment="Stretch"/>
            </ItemsPanelTemplate>
          </ItemsControl.ItemsPanel>
          <ItemsControl.GroupStyle>
            <GroupStyle>
              <GroupStyle.Panel>
                <ItemsPanelTemplate>
                  <!--<WrapPanel IsItemsHost="True"  Orientation="Horizontal" />-->
                  <StackPanel  Orientation="Horizontal" IsItemsHost="True" />
                </ItemsPanelTemplate>
              </GroupStyle.Panel>
              <GroupStyle.ContainerStyle>
                <Style TargetType="{x:Type GroupItem}">
                  <Setter Property="Template">
                    <Setter.Value>
                      <ControlTemplate TargetType="{x:Type GroupItem}">
                        <GroupBox Header="{Binding Name}" MaxWidth="250" MinWidth="120">
                          <ItemsPresenter/>
                        </GroupBox>
                      </ControlTemplate>
                    </Setter.Value>
                  </Setter>
                </Style>
              </GroupStyle.ContainerStyle>
            </GroupStyle>
          </ItemsControl.GroupStyle>
        </ItemsControl>
      </TabItem>
      <TabItem Header="Formatting">
        <ItemsControl
          Name="ribbonList2"
          ItemsSource="{Binding Source={StaticResource FormattingSource}}"
          FocusManager.IsFocusScope="True" >
          <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
              <UniformGrid IsItemsHost="True"/>
            </ItemsPanelTemplate>
          </ItemsControl.ItemsPanel>
          <ItemsControl.GroupStyle>
            <GroupStyle>
              <GroupStyle.Panel>
                <ItemsPanelTemplate>
                  <StackPanel Orientation="Horizontal" IsItemsHost="True"/>
                </ItemsPanelTemplate>
              </GroupStyle.Panel>
              <GroupStyle.ContainerStyle>
                <Style TargetType="{x:Type GroupItem}">
                  <Setter Property="Template">
                    <Setter.Value>
                      <ControlTemplate TargetType="{x:Type GroupItem}">
                        <GroupBox Header="{Binding Name}">
                          <ItemsPresenter/>
                        </GroupBox>
                      </ControlTemplate>
                    </Setter.Value>
                  </Setter>
                </Style>
              </GroupStyle.ContainerStyle>
            </GroupStyle>
          </ItemsControl.GroupStyle>
        </ItemsControl>
        
      </TabItem>
      <TabItem Header="View">
        <ItemsControl
          Name="ribbonList3"
          ItemsSource="{Binding Source={StaticResource FormattingSource}}"
          FocusManager.IsFocusScope="True" >
          <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
              <UniformGrid IsItemsHost="True"/>
            </ItemsPanelTemplate>
          </ItemsControl.ItemsPanel>
          <ItemsControl.GroupStyle>
            <GroupStyle>
              <GroupStyle.Panel>
                <ItemsPanelTemplate>
                  <StackPanel Orientation="Horizontal" IsItemsHost="True"/>
                </ItemsPanelTemplate>
              </GroupStyle.Panel>
              <GroupStyle.ContainerStyle>
                <Style TargetType="{x:Type GroupItem}">
                  <Setter Property="Template">
                    <Setter.Value>
                      <ControlTemplate TargetType="{x:Type GroupItem}">
                        <GroupBox Header="{Binding Name}">
                          <ItemsPresenter/>
                        </GroupBox>
                      </ControlTemplate>
                    </Setter.Value>
                  </Setter>
                </Style>
              </GroupStyle.ContainerStyle>
            </GroupStyle>
          </ItemsControl.GroupStyle>
        </ItemsControl>

      </TabItem>
      <TabItem Header="Add-Ins"/>
      <TabItem Header="Themes"/>
      <TabItem Header="Help"/>
    </TabControl>
    <Border Width="Auto" Height="Auto" CornerRadius="8" Margin="50, 20, 50, 20" BorderBrush="#FF555865" BorderThickness="0.6">

      <RichTextBox x:Name="XAMLRichBox"  SpellCheck.IsEnabled="True" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Width="Auto" Height="Auto" >
        <RichTextBox.CommandBindings>
          <CommandBinding Command="EditingCommands.ToggleBold" />
        </RichTextBox.CommandBindings>
      </RichTextBox>

    </Border>

  </DockPanel>
</Window>
